]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
loginDialog: Move long session-list menus to the side
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 20 Mar 2015 13:29:40 +0000 (14:29 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 23 Mar 2015 19:25:21 +0000 (20:25 +0100)
Currently the menu position below the button means that the menu
can extend to roughly half the screen height before ending up partly
off-screen. This is plenty of space for commonly installed sessions,
but some users have a significantly higher number of sessions in the
list. Move the menu to the side of the button in that case to maximize
the vertical space the menu may take up.

https://bugzilla.gnome.org/show_bug.cgi?id=734352

js/gdm/loginDialog.js

index 8da1b55017c469337ea20bd2ccb03e51af7d6f1c..eed43d711d49147f59e0244d67a4feab9840bdef 100644 (file)
@@ -49,6 +49,7 @@ const _FADE_ANIMATION_TIME = 0.25;
 const _SCROLL_ANIMATION_TIME = 0.5;
 const _TIMED_LOGIN_IDLE_THRESHOLD = 5.0;
 const _LOGO_ICON_HEIGHT = 48;
+const _MAX_BOTTOM_MENU_ITEMS = 5;
 
 const UserListItem = new Lang.Class({
     Name: 'UserListItem',
@@ -283,7 +284,16 @@ const SessionMenuButton = new Lang.Class({
 
         this.actor = new St.Bin({ child: this._button });
 
-        this._menu = new PopupMenu.PopupMenu(this._button, 0, St.Side.TOP);
+        let side = St.Side.TOP;
+        let align = 0;
+        if (Gdm.get_session_ids().length > _MAX_BOTTOM_MENU_ITEMS) {
+            if (this.actor.text_direction == Clutter.TextDirection.RTL)
+                side = St.Side.RIGHT;
+            else
+                side = St.Side.LEFT;
+            align = 0.5;
+        }
+        this._menu = new PopupMenu.PopupMenu(this._button, align, side);
         Main.uiGroup.add_actor(this._menu.actor);
         this._menu.actor.hide();